<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="topbar::static">
</head>

<body>
<!--引用公用的导航栏-->
<nav th:replace="topbar::topbar"></nav>
<div class="container-fluid">
    <div class="row">
        <div th:replace="topbar::sidebar(activeUri='k8svalues.html')"></div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <h1 class="page-header">5GC MANO</h1>
            <h2 class="sub-header">K8sValues信息展示</h2>
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>id</th>
                        <th>vnfInstanceId</th>
                        <th>name</th>
                        <th>deploymentDescription</th>
                        <th>replicas</th>
                        <th>bitrateRequirement</th>
                        <th>podDescription</th>
                        <th>imageUrl</th>
                        <th>portName</th>
                        <th>containerPort</th>
                        <th>servicePort</th>
                        <th>l4protocol</th>
                        <th>requestCpu</th>
                        <th>requestMemory</th>
                        <th>cpuLimit</th>
                        <th>memoryLimit</th>
                        <th>location</th>
                        <th>podAffinity</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="k8svalue:${k8svalues}">
                        <td th:text="${k8svalue.id}"></td>
                        <td th:text="${k8svalue.vnfInstanceId}"></td>
                        <td th:text="${k8svalue.name}"></td>
                        <td th:text="${k8svalue.deploymentDescription}"></td>
                        <td th:text="${k8svalue.replicas}"></td>
                        <td th:text="${k8svalue.bitrateRequirement}"></td>
                        <td th:text="${k8svalue.podDescription}"></td>
                        <td th:text="${k8svalue.imageUrl}"></td>
                        <td th:text="${k8svalue.portName}"></td>
                        <td th:text="${k8svalue.containerPort}"></td>
                        <td th:text="${k8svalue.servicePort}"></td>
                        <td th:text="${k8svalue.l4protocol}"></td>
                        <td th:text="${k8svalue.requestCpu}"></td>
                        <td th:text="${k8svalue.requestMemory}"></td>
                        <td th:text="${k8svalue.cpuLimit}"></td>
                        <td th:text="${k8svalue.memoryLimit}"></td>
                        <td th:text="${k8svalue.location}"></td>
                        <td th:text="${k8svalue.podAffinity}"></td>
                        <td>
                            <button type="button" class="btn btn-primary" th:onclick="|transTofile(${k8svalue.id})|">
                                转换为Values.yaml文件
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    function transTofile(id) {
        var url = "http://"+hostIp+":8002/k8svalues/toFile";
        $.ajax({
            url: url,
            type: "POST",
            data: {
                "id": id
            },
            complete: function (id) {
                alert("转化成功");
                reload();
            }
        });
    }
</script>
</html>
